﻿using PosClient.Interfaces;
using PosClient.Model;
using PosClient.ViewModel;
using Splat;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Concurrency;
using System.Text;
using System.Threading.Tasks;

namespace PosClient.Job.DownLoad
{
    public class PromoteDownLoadJob:IJob
    {
        public Result<JobEntity> Excute()
        {
            Result<JobEntity> result = new Result<JobEntity>()
            {
                Success = true,
                Message = "请求成功"
            };
            var viewModel = Locator.Current.GetService<MainViewModel>();
            viewModel._mainScheduler.Schedule(() =>
            {
                viewModel.SubText = "正在下载促销数据...";
                viewModel.Loading = true;
            });


            viewModel._mainScheduler.Schedule(() =>
            {
                viewModel.SubText = string.Empty;
                viewModel.Loading = false;
            });
            return result;
        }
    }
}
